package com.sanqing.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.sanqing.dao.base.BaseDao;
import com.sanqing.po.ExamineHis;
import com.sanqing.service.ExamineHisService;

@Service("examineHisService")
@Transactional(readOnly = true)
public class ExamineHisServiceImpl implements ExamineHisService {

	@Resource(name = "examineHisDao")
	private BaseDao<ExamineHis, String> examineHisDao;

	@Override
	@Transactional(readOnly = false)
	public void add(ExamineHis his) {
		examineHisDao.save(his);
	}

	@Override
	public List<ExamineHis> getList(String scoreId, String typeId) {
		Map<String, Object> values = new HashMap<String, Object>();
		values.put("scoreId", scoreId);
		values.put("typeId", typeId);
		String hql = "from ExamineHis a where a.score.id=:scoreId and a.subject.subjectType=:typeId";
		return examineHisDao.find(hql, values);
	}

}
